Detailed insights for your shortened URL
Redirects to: class Solution { int ind =0; public boolean isTrionic(int[] nums) { inc(nums); System.out.println("pass"); if(ind >= nums.length-1) return false; dec(nums); System.out.println("pass"); if(ind >= nums.length-1){ return false;} inc(nums); System.out.println("pass"); if(ind != nums.length) return false; System.out.println(ind); System.out.println("pass"); return true; } private void inc(int[] nums) { Stack<Integer> st = new Stack<>(); while(ind < nums.length) { if(st.isEmpty() || nums[ind] > st.peek()) { st.push(nums[ind]); ind++; } else { ind--; break; } } } private void dec(int[] nums) { Stack<Integer> st = new Stack<>(); while(ind < nums.length) { if(st.isEmpty() || nums[ind] < st.peek()) { st.push(nums[ind]); ind++; } else { ind--; break; } } } }